/*
 * Copyright 2019 http://www.whcrow.com All rights reserved.
 */

package com.whcrow.example.mybatisplus.module;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * UserDO
 *
 * @author whcrow
 * @version 1.0.0
 */
@Getter
@Setter
@ToString
@TableName(value = "user")
public class UserDO implements Serializable {

    private static final long serialVersionUID = 6191297698569055969L;

    @TableField(value = "username")
    private String username;

    /**
     * 创建时间
     */
    @TableField(value = "create_date", fill = FieldFill.INSERT)
    private LocalDateTime createDate;

    /**
     * 最后修改时间
     */
    @TableField(value = "update_date", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateDate;

    /**
     * 主键id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "`id`", type = IdType.ID_WORKER)
    private Long id;

    /**
     * 乐观锁
     */
    @Version
    @TableField("`version`")
    private Long version;

}
